# GNU LICENCE
# Kyori code.

from libs.lattice.diagram import init_diagram,addIntent,addObject,cleanFlags,printLattice,toBottom
from libs.files.utils import read_object_list
import sys

if __name__ == "__main__":
    path = sys.argv[1]
    print '*'*100
    print 'SePyrot - AddIntent for Python - KY'
    print '*'*100
    attributes = read_object_list(path)
    g = init_diagram()
    for object,intent in enumerate(attributes):
        print '\r -> EXECUTING OBJECT:',object,'/',len(attributes),
        sys.stdout.flush()
        toBottom(g,intent)
        aid = addIntent(g,intent,-1)
        addObject(g,aid,object)
        cleanFlags(g,aid)
    print ' '*5,len(g.nodes()),'concepts found'
    printLattice(g)


    #print g.nodes(data=True)